# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=aggroargs
pkgver=51.c032446
pkgrel=3
groups=('blackarch' 'blackarch-exploitation' 'blackarch-fuzzer')
pkgdesc='Bruteforce commandline buffer overflows, linux, aggressive arguments.'
arch=('any')
url='https://github.com/tintinweb/aggroArgs'
license=('GPL2')
depends=('python2')
makedepends=('git')
source=("$pkgname::git+https://github.com/tintinweb/aggroArgs.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.* LICENSE

  cp -a src/* "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/aggroargs
exec python2 __main__.py "\${@}"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

